﻿CREATE PROCEDURE [dbo].[Hogar_Integrante_ObtenerPorNroDoc] 
 @NroDocumento VARCHAR(10),
 @TipoDocumento INT
AS 
BEGIN

/*****************************************************************************************************************************************/
-- Author: Carlos Mendoza
-- Purpose:   obtener un integrante por nro doc y tipo doc
-- Returns:    Integrante
/*****************************************************************************************************************************************/ 
	
	SELECT  [IntegranteId],
			[Dni],
			[Nombre],
			[Apellido],
			CASE WHEN [Activo] = 1 THEN 1 ELSE 0 END AS [Activo],
			[TipoDocumentoId],
			[FechaNacimiento],
			[Domicilio],
			[Telefono],
			[EstadoCivilId],
			[NivelEstudioId],
			CASE WHEN [NivelEstudioCompleto] = 1 THEN 1 ELSE 0 END AS [NivelEstudioCompleto],
			[PropiedadViviendaId],
			[BeneficioPrevisionalId],
			[Monto],
			[ObraSocialId],
			[NroAfiliado],
			[ServicioEmergenciaId],
			[CuotaCooperadora],
			[FechaBaja],
			ISNULL([ObservacionBaja],'') AS [ObservacionBaja],
			[FechaInscripcion],
			ISNULL([Entrevista],'') AS [Entrevista]
	FROM [dbo].[Integrante] WITH (NOLOCK)
	WHERE [Dni] = @NroDocumento AND [TipoDocumentoId] = @TipoDocumento AND [Activo] = 1
	
END